<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>108Wo室内设计数据资源中心 - 我的栏目</title>
<link href="{CSS_PATH}108wo/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="{JS_PATH}108wo/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
var cats = {$cats_json};
$(function(){
	$("#catid_1").change(function(){
		var catid_1 = this.value;
		var html="";
		for(i in cats) {
			if(cats[i].catid == catid_1) {
				for(j in cats[i].child) {
					html += "<option value='"+cats[i].child[j].catid+"'>"+cats[i].child[j].catname+"</option>";
				}
				$("#catid_2").html(html);
			}
		}
	});
	
	$('#createForm').submit(function(){
		$('#msgBox').fadeIn("fast")
		if($.trim($("#info_name").val()).length == 0) {
			$('#msgBox').html("<div class='err'>请输入栏目名称</div>");
			setTimeout(function(){$("#msgBox").fadeOut("fast");},1000);
			$("#info_name").focus();
			return false;
		}
		if($.trim($("#info_pcompanyname").val()).length == 0) {
			$('#msgBox').html("<div class='err'>请输入供应商名称</div>");
			setTimeout(function(){$("#msgBox").fadeOut("fast");},1000);
			$("#info_pcompanyname").focus();
			return false;
		}
		if($.trim($("#info_prealname").val()).length == 0) {
			$('#msgBox').html("<div class='err'>请输入联系人</div>");
			setTimeout(function(){$("#msgBox").fadeOut("fast");},1000);
			$("#info_prealname").focus();
			return false;
		}
		if($.trim($("#info_pqq").val()).length == 0) {
			$('#msgBox').html("<div class='err'>请输入联系QQ</div>");
			setTimeout(function(){$("#msgBox").fadeOut("fast");},1000);
			$("#info_pqq").focus();
			return false;
		}
		if($.trim($("#info_paddress").val()).length == 0) {
			$('#msgBox').html("<div class='err'>请输入联系地址</div>");
			setTimeout(function(){$("#msgBox").fadeOut("fast");},1000);
			$("#info_paddress").focus();
			return false;
		}
		if($.trim($("#info_ptel").val()).length == 0) {
			$('#msgBox').html("<div class='err'>请输入联系电话</div>");
			setTimeout(function(){$("#msgBox").fadeOut("fast");},1000);
			$("#info_ptel").focus();
			return false;
		}
		
		$('#msgBox').html("<div class='loading'>创建中，请稍后...</div>");
		$.post($(this).attr('action'), $(this).serializeArray(), function(data){
			if(data == "操作成功！")
			{
				//parent.$('#fancybox-close').click();
				setTimeout(function(){$('#msgBox').html("<div class='suc'>创建栏目成功...</div>");},500);
				setTimeout(function(){$("#msgBox").fadeOut("fast");},1000);
				setTimeout(function(){top.location.reload();},1200);
			}				
			else{
				$('#msgBox').html("<div class='err'>"+data+"</div>");
				setTimeout(function(){$("#msgBox").fadeOut("fast");},1000);
			}
		});

		return false;
	});
	
})
</script>
</head>
<body style="background:none">
<div id="msgBox"></div>
<div id="createList">
	<h1>创建栏目</h1>		
	<ul>
		<form action="{APP_PATH}index.php?m=brand&c=index&a=add" method="POST" id="createForm">
		<table cellpadding="0" cellspacing="0">
			<tr>
				<td width="30%" align="right"><span style="color:red;">*</span>栏目选择</td>
				<td>
                	<select name="info[catid_1]" id="catid_1">
                    	{loop $cats $r}
                        <option value="{$r[catid]}">{$r[catname]}</option>
                        {/loop}
                    </select>
                    <select name="info[catid_2]" id="catid_2">
                    	{loop $cats[0][child] $r}
                        <option value="{$r[catid]}">{$r[catname]}</option>
                        {/loop}
                    </select>
                </td>
			</tr>
			<tr>
				<td align="right"><span style="color:red;">*</span>栏目名称</td>
				<td><input type="text" name="info[name]" id="info_name" value="" size="32" /></td>
			</tr>
            <tr>
				<td align="right">供应商名称</td>
				<td><input type="text" name="info[pcompanyname]" id="info_pcompanyname" value="{$memberinfo[companyname]}" size="32" /></td>
			</tr>
            <tr>
				<td align="right"><span style="color:red;">*</span>联系人</td>
				<td><input type="text" name="info[prealname]" id="info_prealname" value="{$memberinfo[realname]}" size="32" /></td>
			</tr>
            <tr>
				<td align="right"><span style="color:red;">*</span>QQ</td>
				<td><input type="text" name="info[pqq]" id="info_pqq" value="{$memberinfo[qq]}" size="32" /></td>
			</tr>
            <tr>
				<td align="right"><span style="color:red;">*</span>联系地址</td>
				<td><input type="text" name="info[paddress]" id="info_paddress" value="{$memberinfo[address]}" size="32" /></td>
			</tr>
            <tr>
				<td align="right"><span style="color:red;">*</span>联系电话</td>
				<td><input type="text" name="info[ptel]" id="info_ptel" value="{$memberinfo[tel]}" size="32" /></td>
			</tr>
            <tr>
				<td align="right">分类<br />&nbsp;</td>
				<td><input type="text" name="info[child]" id="info_child" value="" size="32" /><br /><span>多个分类名称请用  逗号 ， 分开</span></td>
			</tr>
			<tr>
				<td align="right">&nbsp;</td>
				<td><button type="submit">立即创建</button></td>
			</tr>
		</table>
		<input type="hidden" name="dosubmit" value=1 />
		<input type="hidden" name="doajax" value=1 />
		</form>
	</ul>
</div>
</body>
</html>
